﻿using System;

namespace week2_work3
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] num = new int[101];
            for (int i = 2; i < num.Length; i++) {          //为2~100赋值到num[2~100]
                num[i] = i;
            }
            for (int i = 2; i < num.Length; i++) {
                for (int n = 2; i * n < num.Length; n++) {
                    num[i * n] = 0;
                }
            }
            Console.WriteLine("2~100的素数有：");
            for (int i = 2; i < num.Length; i++)
            {
                if (num[i] != 0)
                {
                    Console.Write(num[i]+" ");
                }
            }
        }
    }
}
